<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    div {
      height: 200vh;
      background-color: antiquewhite;
    }
  </style>
</head>

<body>
  <div>
    测试页面
    <button id="btn">按钮点击</button>
    <button id="btn2">按钮点击2</button>
  </div>

  <script src="./1.手写节流.js"></script>
  <script src="./2.手写防抖.js"></script>
  <script>
    window.onscroll = throttling(function (e) {
      console.log(e);
    }, 1000)

    btn.onclick = throttling(function (e) {
      console.log(e);
    }, 1000)

    btn2.onclick = debounceX(function (e) {
      console.log('防抖');
    }, 1000, true)
  </script>
</body>

</html>